<!-- 引入模板文件 -->
{% extends "public_base.html" %}
<!-- 导入自定义过滤器 -->
{% load format %}

<!-- 替换原 block content 内容 -->
{% block content %}
    <h3 style="text-align: center">Ansible 主机组列表</h3>
    <table class="table table-bordered">
        <tr style="background-color:#e5dfdf">
            <td>GroupName</td>
            <td>Hosts</td>
            <td>描述</td>
        </tr>
                {% for group in object_list %}
        <tr>
            <td>
                <a href="/ansible/get_groups/{{group.pk}}/">{{ group.groupName }}</a>
            </td>
            <td>
                {% for host in group.hostList.all %}
                    <a href="/ansible/get_hosts/{{host.pk}}/">{{ host.hostName }}:  {{ host.hostIP }},</a>
                    <br>
                {% endfor %}
            </td>
            <td>{{ group.groupDesc }}</td>
        </tr>
        {% endfor %}
    </table>

{% endblock %}